﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CircuitBoardApplication.Classes.Components
{
    class Gate : ComponentMain
    {
        private int input;

        public Gate(int id, String type, int value, int x, int y)
            : base(id, type, value, x, y)
        {
            ID = id;
            Type = type;
            Value = value;
            X = x;
            Y = y;
        }

        public int Input
        {
            get { return this.input; }
            set { this.input = value; }
        }

        public override string ToString()
        {
            return base.ToString() + " Input: " + Input.ToString();
        }

        public override void setInputsFromConnections(Connection conn)
        {
                if (conn.RECEIVINGComponent == this)
                    //if (input == null) -- BOOL CANNOT BE NULL. 
                    this.input = conn.SENTComponent.Value;
        }

        public virtual int Calculate()
        {
            return -1;
        }
        
       
    }
}
